home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 97 / CD-ROM 97 / CD-ROM 97.iso / internet / ghostzilla / ghsetup.exe / chrome / pippki.jar / content / pippki / newserver.js < prev    next >
Encoding:
Text File  |  2002-04-09  |  2.6 KB  |  94 lines

  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
  2.  *
  3.  * The contents of this file are subject to the Mozilla Public
  4.  * License Version 1.1 (the "License"); you may not use this file
  5.  * except in compliance with the License. You may obtain a copy of
  6.  * the License at http://www.mozilla.org/MPL/
  7.  *
  8.  * Software distributed under the License is distributed on an "AS
  9.  * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
  10.  * implied. See the License for the specific language governing
  11.  * rights and limitations under the License.
  12.  *
  13.  * The Original Code is mozilla.org code.
  14.  *
  15.  * The Initial Developer of the Original Code is Netscape
  16.  * Communications Corporation.  Portions created by Netscape are
  17.  * Copyright (C) 1998 Netscape Communications Corporation. All
  18.  * Rights Reserved.
  19.  *
  20.  * Contributor(s):
  21.  *  Javier Delgadillo <javi@netscape.com>
  22.  *  Hσkan Waara <hwaara@chello.se>
  23.  */
  24.  
  25.  
  26. const nsIDialogParamBlock = Components.interfaces.nsIDialogParamBlock;
  27. const nsIPKIParamBlock    = Components.interfaces.nsIPKIParamBlock;
  28. const nsIX509Cert         = Components.interfaces.nsIX509Cert;
  29.  
  30. var dialogParams;
  31. var pkiParams;
  32. var cert;
  33.  
  34.  
  35. function onLoad()
  36. {
  37.  
  38.   pkiParams    = window.arguments[0].QueryInterface(nsIPKIParamBlock);
  39.   dialogParams = pkiParams.QueryInterface(nsIDialogParamBlock);
  40.  
  41.   var isupport = pkiParams.getISupportAtIndex(1);
  42.   cert = isupport.QueryInterface(nsIX509Cert);
  43.  
  44.   var bundle = srGetStrBundle("chrome://pippki/locale/newserver.properties");
  45.   var gBundleBrand = srGetStrBundle("chrome://global/locale/brand.properties");
  46.  
  47.   var brandName = gBundleBrand.GetStringFromName("brandShortName");
  48.   var continueButton = bundle.GetStringFromName("continueButton");
  49.  
  50.   document.documentElement.getButton("accept").label = continueButton;
  51.  
  52.   var message = 
  53.     bundle.formatStringFromName("newServerMessage",
  54.                                  [cert.commonName],
  55.                                  1);
  56.   var notRecognized = 
  57.     bundle.formatStringFromName("certNotRecognized", 
  58.                                  [brandName], 
  59.                                  1);
  60.  
  61.   setText("message", message);
  62.   setText("notRecognized", notRecognized);
  63.   window.sizeToContent();
  64. }
  65.  
  66. function doHelpButton()
  67. {
  68.   openHelp('new_web_cert');
  69. }
  70.  
  71. function doOK()
  72. {
  73.   // the user pressed OK
  74.   dialogParams.SetInt(1,1);
  75.   var checkbox = document.getElementById("alwaysAccept");
  76.  
  77.   // 0 = accept perm, 1 = accept for this session - just the opposite
  78.   // of the checkbox value.
  79.   dialogParams.SetInt(2, !checkbox.checked);
  80.   return true;
  81. }
  82.  
  83. function doCancel()
  84. {
  85.   // the user pressed cancel
  86.   dialogParams.SetInt(1,0);
  87.   return true;
  88. }
  89.  
  90. function viewCert()
  91. {
  92.   cert.view();
  93. }
  94.